package com.project.redis.service.impl;

import com.project.redis.service.RedisService;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 缓存业务层
 * @author mengxj
 */
@Service
public class RedisServiceImpl implements RedisService {

    @Resource
    private RedisTemplate<Object, Object> redisTemplate;

    @Override
    public void set(String key, String value){
        System.out.println("=============");
        this.redisTemplate.opsForValue().set(key, value);
    }

    @Override
    public Object get(String key){
        System.out.println("=============");
        System.out.println(this.redisTemplate.opsForValue().get(key));
        return this.redisTemplate.opsForValue().get(key);
    }
}
